|
|
|
 | By moving to the last row in the recordset, you force all the rows to be loaded into the cache. This allows the data control to count the number of rows. Then, of course, you need to reposition yourself back to the first row in the recordset so that youre at the beginning of the set when the form is displayed. Now lets add the code to display the record count in the Caption property of the data control. |
|
|
| Write the MoveComplete() Event 1. Double-click the Employees data control. 2. Position to the MoveComplete event and add the following code: | | Private Sub datEmployees_MoveComplete(_
ByVal adReason As ADODB.EventReasonEnum, _
ByVal pError As ADODB.Error, _
adStatus As ADODB.EventStatusEnum, _
ByVal pRecordset As ADODB.Recordset)
Debug.Print "MoveComplete"
If pRecordset.EOF Or pRecordset.BOF Then
Else
Call ControlsTagLoad(pRecordset) With datEmployees
.Caption = "Rec: " & _
.Recordset.AbsolutePosition & _
" of " & _
.Recordset.RecordCount End With
End If
End Sub |  | In this code, you use the AbsolutePosition property to retrieve the current record number from the Recordset property of the data control. You also use the RecordCount property of the Recordset object to retrieve the total amount of rows in the recordset. |
|
|
|